package models;

import com.et.ar.ActiveRecordBase;
import com.et.ar.annotations.BelongsTo;
import com.et.ar.annotations.Column;
import com.et.ar.annotations.Id;
import com.et.ar.annotations.Table;
import com.et.ar.annotations.Unique;

import java.sql.*;


@Table(name="hotkeywords")
public class Hotkeyword extends ActiveRecordBase{
	@Id private Integer id;
	@Column private String word;
	@Column private String cond;
	@Column private Integer sort;
	@Column private Integer groupid;
	@Column private Integer status;
	@Column 
	@Unique(message = "代号不能重复")
	private String code;

	//	@BelongsTo(foreignKey="demoId")
	//	private Demo demo;

	//	public Demo getDemo() {
	//		return demo;
	//	}
	//	public void setDemo(Demo demo) {
	//		this.demo = demo;
	//	}

	//	public int getChildCount() throws Exception {
	//		return (int)count(Hotkeyword.class, "parentId=?", new Object[]{id});
	//	}
	//	public String findChildIds() throws Exception {
	//		String s = "";
	//		List<Integer> ids = new ArrayList<Integer>();
	//		ids.add(id);
	//		while(!ids.isEmpty()){
	//			int id = ids.remove(0);
	//			s += id + ",";
	//			for(Hotkeyword item: Hotkeyword.findAll(Hotkeyword.class, "parentId=?", new Object[]{id})){
	//				ids.add(item.getId());
	//			}
	//		}
	//		if (!s.equals("")){
	//			s = s.substring(0, s.length() - 1);
	//		}
	//		return s;
	//	}
	public void setId(Integer id){
		this.id=id;
	}
	public Integer getId(){
		return id;
	}

	public void setWord(String word){
		this.word=word;
	}
	public String getWord(){
		return word;
	}

	public void setCond(String cond){
		this.cond=cond;
	}
	public String getCond(){
		return cond;
	}

	public void setSort(Integer sort){
		this.sort=sort;
	}
	public Integer getSort(){
		return sort;
	}

	public void setGroupid(Integer groupid){
		this.groupid=groupid;
	}
	public Integer getGroupid(){
		return groupid;
	}

	public void setStatus(Integer status){
		this.status=status;
	}
	public Integer getStatus(){
		return status;
	}

	public void setCode(String code){
		this.code=code;
	}
	public String getCode(){
		return code;
	}
}

